package time;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 *
 */
public class CalendarTest {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(2021, 9, 1);   //month – the value used to set the MONTH calendar field. Month value is 0-based. e.g., 0 for January
        calendar.set(2021, Calendar.OCTOBER, 1);   //month – the value used to set the MONTH calendar field. Month value is 0-based. e.g., 0 for January
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(simpleDateFormat.format(calendar.getTime()));    //2021-10-01 18:36:30
    }
}
